// Copyright (C) 2024 Kumo inc.
// Author: Jeff.li lijippy@163.com
// All rights reserved.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published
// by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <https://www.gnu.org/licenses/>.
//
#include <sys/types.h>
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#ifdef HAVE_SYS_RESOURCE_H
#include <sys/resource.h>
#endif

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>

#include <tally/sigar/sigar.h>
#include <tally/sigar/sigar_private.h>
#include <tally/sigar/sigar_format.h>
#include <ktest/ktest.h>

TEST(test_sigar, sys_info_get) {
    sigar_t *t;
    ASSERT_TRUE(SIGAR_OK == sigar_open(&t));
	sigar_sys_info_t sysinfo;

	ASSERT_TRUE(SIGAR_OK == sigar_sys_info_get(t, &sysinfo));
	ASSERT_TRUE(sysinfo.name);
	ASSERT_TRUE(sysinfo.version);
	ASSERT_TRUE(sysinfo.arch);
	ASSERT_TRUE(sysinfo.machine);
	ASSERT_TRUE(sysinfo.description);
	ASSERT_TRUE(sysinfo.patch_level);
	ASSERT_TRUE(sysinfo.vendor);
	ASSERT_TRUE(sysinfo.vendor_version);
	ASSERT_TRUE(sysinfo.vendor_name);
	ASSERT_TRUE(sysinfo.vendor_code_name);
    sigar_close(t);
}

